package com.atguigu.juc1205.demo;

import java.util.concurrent.TimeUnit;

/**
 * @Author Joey
 * @Date 2021/10/12 15:34
 * @Description
 */
public class TestThread {
    public static void main(String[] args) {
        while (true){
            new Thread(() -> {
                try {
                    TestThread.sendEmail();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }).start();
        }
    }

    public static synchronized void sendEmail() throws Exception {
        TimeUnit.SECONDS.sleep(4);
        System.out.println("发邮件");
    }
}
